import 'package:flutter/material.dart';

class EphemeralWidget extends StatefulWidget {
  const EphemeralWidget({ super.key });

  @override
  State<EphemeralWidget> createState() => _EphemeralWidgetState();
}

class _EphemeralWidgetState extends State<EphemeralWidget> {
  int count = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Ephemeral Widget")),
      body: Center(
        child: Column(
          children: [
            Text("$count"),
            ElevatedButton(
              onPressed: () {
                setState(() {
                  count++;
                });
              },
              child: const Text("count++")
            ),
          ],
        ),
      ),
    );
  }
}